Skip to content

btc(coin): wire won-block reconstructor into main_btc run-loop (reconstructor slice 7/7 — FINAL) - #844

Merged
frstrtr merged 1 commit into
masterfrom
btc/reconstruct-runloop-wire
Jul 25, 2026
Merged

btc(coin): wire won-block reconstructor into main_btc run-loop (reconstructor slice 7/7 — FINAL)#844
frstrtr merged 1 commit into
masterfrom
btc/reconstruct-runloop-wire

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Reconstructor slice 7/7 — FINAL

Un-stubs tracker.m_on_block_found in src/c2pool/main_btc.cpp. make_on_block_found (#744) has been defined but never assigned since the arc began, so a share clearing the parent target was silently dropped. This slice composes the merged building blocks (#822/#835/#837/#838/#839/#840) into the live run-loop.

Wiring

New seam

Node::submit_block_hex_str(hex) forwards the reconstructor hex straight to submitblock (no bytes round-trip).

Scope / tests

  • btc-tree only. No CMakeLists change — all edits to already-compiled files.
  • Cut off fresh master 6dc83fdc3 (base-off-master rule).
  • btc_share_test 106/106 (reconstruct + wiring suites green); c2pool-btc links clean.

Closes the won-block dispatch arc.

…structor slice 7/7 — FINAL)

Un-stub tracker.m_on_block_found in src/c2pool/main_btc.cpp: a share that
clears the PARENT target now reconstructs the full parent block from live
tracker state + the captured template txs and fires the connect-authoritative
dual path (P2P relay + submitblock RPC). Until now make_on_block_found (#744)
was defined but NEVER assigned, so won shares were silently dropped.

Wiring (composes the merged slices 1-6):
- TemplateCapture (#837) declared at main scope; create_share_fn seeds it,
  keyed by the freshly-minted share_hash, with the template non-coinbase tx
  set ([{"data": <raw-tx-hex>}, ...], template order) so a won share replays
  the EXACT body it committed to; a capture MISS -> valid coinbase-only block.
- make_reconstruct_closure (#839) bound to the live tracker:
    * share_fields_fn  -> share m_min_header + compile-time version +
      m_merkle_link + optional segwit txid_merkle_link (read chain DIRECTLY:
      fires on the compute thread already holding m_tracker_mutex exclusively,
      so it must NOT take read_tracker()).
    * gentx_bytes_fn   -> generate_share_transaction SSOT with a new opt-in
      out-param exposing the non-witness gentx bytes (the SAME bytes hashed to
      the committed txid; v36_active=false is byte-identical to the verify-path
      call, share_check.hpp:1807) -> merkle-consistent.
    * template_other_txs_fn -> make_template_other_txs_fn(capture.provider())
      (#840 decode contract; malformed => fail CLOSED).
- make_on_block_found (#744) dual-path: both network sinks are single-thread-
  confined to the io_context, so each io::post its write onto ioc; the audit
  reflects arm availability (has_p2p/has_rpc) while the daemon verdict is logged
  by submit_block_hex (#752) + pending_submits on the io thread.

New seam: Node::submit_block_hex_str(hex) forwards the reconstructor hex
straight to the submitblock RPC (no bytes round-trip).

btc-tree only; no CMakeLists change (all edits to already-compiled files).
btc_share_test 106/106 (reconstruct + wiring suites green).
@frstrtr
frstrtr merged commit b897169 into master Jul 25, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant